﻿<%--
  Created by IntelliJ IDEA.
  User: 27716
  Date: 2024/10/23
  Time: 19:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
    <script src="../../static/js/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="../../static/css/css.css">
</head>
<body>
用户名 ： <input type="text" id="username">; <br>
备注 ： <textarea id="remark" cols="30" rows="10" maxlength="100" placeholder="最少输入100字"></textarea> <br>
<input type="button" id="add" value="添加">
</body>
<script>
    $("#add").click(function () {
        let username = $("#username").val();
        let remark = $("#remark").val();
        let obj = {username: username, remark: remark}
        $.ajax({
            url: "/role/addGet",
            type: "post",
            data: {reqInfos: JSON.stringify(obj)},
            dataType: "json",
            success(res) {
                if (res === 200) {
                    alert("添加成功");
                    location.href = "list.jsp";
                }
            },
            error() {
                alert("不能添加")
            }
        })
    })
</script>
</html>
